package api

import (
	"gfdemo/app/modules/demo/internal/define"
	"gfdemo/app/modules/demo/internal/service"
	"gfdemo/library/response"
	"github.com/gogf/gf/v2/net/ghttp"
)

var Demo = demoApi{}

type demoApi struct {
}

func (a *demoApi) Index(r *ghttp.Request) {

	var (
		rqs *define.TestApiInfoRqs
	)
	err := r.Parse(&rqs)
	if err != nil {
		response.JsonExit(r, 1, err.Error())
	}
	err = service.Demo.Index(r.Context(), rqs)
	if err != nil {
		response.JsonExit(r, 1, err.Error())
	}
	response.JsonExit(r, 200, "添加成功")
}
